import re

s = 'python study hard'
# 从开头匹配
result = re.match('python', s)
print(result)
print(result.span())
print(result.group())

result = re.match('1python', s)
# None
print(result)
# print(result.span())
# print(result.group())

s = '66python66 study66 python hard'
# 搜索第一个匹配的
result = re.search('python', s)
print(result)
print(result.span())
print(result.group())

result = re.findall('python', s)
# ['python', 'python']
print(result)

result = re.findall('yes', s)
# []
print(result)
